import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const TopNavigationMeta: IPublicTypeComponentMetadata = {
  "componentName": "TopNavigation",
  "title": "顶部导航",
  "docUrl": "",
  "group": "首页",
  "screenshot": "",
  "devMode": "proCode",
  "npm": {
    "package": "hzdz-charts",
    "version": "0.1.0",
    "exportName": "TopNavigation",
    "main": "src/index.tsx",
    "destructuring": true,
    "subName": ""
  },
  "configure": {
    "props": [
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "items",
            "zh-CN": "导航项"
          }
        },
        "name": "items",
        "setter": {
          "componentName": "JsonSetter",
          "isRequired": false,
          "initialValue": [
            { key: 'home', title: '首页' },
            { key: 'travel', title: '出行服务' },
            { key: 'emergency', title: '应急管理' },
            { key: 'environment', title: '气象防灾' },
            { key: 'energy', title: '消防安全' },
            { key: 'government', title: '综合执法' },
            { key: 'smart-community', title: '员工管理' },
            { key: 'smart-security', title: '设施环境' },
            { key: 'smart-water', title: '城站专题' }
          ]
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "defaultActiveKey",
            "zh-CN": "默认激活项"
          }
        },
        "name": "defaultActiveKey",
        "setter": {
          "componentName": "StringSetter",
          "isRequired": false,
          "initialValue": "home"
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "activeKey",
            "zh-CN": "受控激活项"
          }
        },
        "name": "activeKey",
        "setter": {
          "componentName": "StringSetter",
          "isRequired": false
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "alignment",
            "zh-CN": "对齐方式"
          }
        },
        "name": "alignment",
        "setter": {
          "componentName": "SelectSetter",
          "props": {
            "dataSource": [
              { "label": "左对齐", "value": "left" },
              { "label": "居中", "value": "center" },
              { "label": "右对齐", "value": "right" }
            ],
            "defaultValue": "right"
          }
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "height",
            "zh-CN": "组件高度"
          }
        },
        "name": "height",
        "setter": {
          "componentName": "NumberSetter",
          "initialValue": 80
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "backgroundColor",
            "zh-CN": "背景颜色"
          }
        },
        "name": "backgroundColor",
        "setter": {
          "componentName": "ColorSetter"
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "activeColor",
            "zh-CN": "激活颜色"
          }
        },
        "name": "activeColor",
        "setter": {
          "componentName": "ColorSetter",
          "initialValue": "#ffffff"
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "textColor",
            "zh-CN": "文字颜色"
          }
        },
        "name": "textColor",
        "setter": {
          "componentName": "ColorSetter",
          "initialValue": "rgba(255, 255, 255, 0.8)"
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "fontSize",
            "zh-CN": "字体大小"
          }
        },
        "name": "fontSize",
        "setter": {
          "componentName": "NumberSetter",
          "initialValue": 28
        }
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "fontWeight",
            "zh-CN": "字体粗细"
          }
        },
        "name": "fontWeight",
        "setter": {
          "componentName": "SelectSetter",
          "props": {
            "dataSource": [
              { "label": "细体", "value": 300 },
              { "label": "正常", "value": 400 },
              { "label": "中等", "value": 500 },
              { "label": "半粗", "value": 600 },
              { "label": "粗体", "value": 700 }
            ],
            "defaultValue": 400
          }
        }
      }
    ],
    "supports": {
      "style": true,
      "events": [
        {
          "name": "onItemClick",
          "description": "导航项点击事件"
        }
      ]
    },
    "component": {}
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    "title": "*顶部导航",
    "screenshot": "",
    "schema": {
      "componentName": "TopNavigation",
      "props": {
        "items": [
          { key: 'home', title: '首页' },
          { key: 'travel', title: '出行服务' },
          { key: 'emergency', title: '应急管理' },
          { key: 'environment', title: '气象防灾' },
          { key: 'energy', title: '消防安全' },
          { key: 'government', title: '综合执法' },
          { key: 'smart-community', title: '员工管理' },
          { key: 'smart-security', title: '设施环境' },
          { key: 'smart-water', title: '城站专题' }
        ],
        "defaultActiveKey": "home",
        "alignment": "right"
      }
    }
  }
];

export default {
  ...TopNavigationMeta,
  snippets
};